<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
	<title>CRM</title>
	<link rel="stylesheet" href="css/bootstrap.min.css" />
	<link rel="stylesheet" href="css/bootstrap-responsive.min.css" />
	<link rel="stylesheet" href="css/jquery.validity.css"/>
</head>
<body>
	<%@ include file="include/loginhead.jsp" %>
	
	<div class="container" style="margin-top:60px">
			<h4 class="page-header">
				快速注册，立即体验！
			</h4>
		
		<div class="row">
			<div class="span8">
			<form accept-charset="UTF-8" action="sign.jspx" class="simple_form form-horizontal" id="sign-form" method="post" >
				<div class="control-group string optional">
				<label class="string optional control-label" for="user_company_name"> 
				<abbr title="required">*</abbr>
				公司名称
				</label>
				<div class="controls">
				<input class="string optional" id="company" title="公司名称" name="orgName.name" size="50" type="text" />
				<p class="help-block">或者团队，机构，学校等</p>
				</div>
				</div>
				<div class="control-group string optional">
				<label class="string optional control-label" for="user_name"> 姓名</label>
				<div class="controls">
				<input class="string optional" id="name" title="姓名" name="user.name" size="50" type="text" />
				</div>
				</div>
				
				<div class="control-group email required">
				<label class="email required control-label" for="user_email">
				<abbr title="required">*</abbr>
				Email
				</label>
				<div class="controls">
				<input class="string email required" id="email" title="Email" name="user.email" size="50" type="text"/>
				<p class="help-block" id="email-help">用来接收激活邮件，以及登录</p>
				</div>
				</div>
				
				<div class="control-group password required">
				<label class="password required control-label" for="user_password">
				<abbr title="required">*</abbr>
				密码
				</label>
				<div class="controls">
				<input class="password required" title="密码" id="password" name="user.password" size="50" type="password" x-webkit-speech=""/>
				<p class="help-block" id="password-help">至少6位并且包含1位数字的密码组合更安全</p>
				</div>
				</div>
				
				<div class="control-group password optional">
				<label class="password optional control-label" for="user_password_confirmation">* 再次输入密码</label>
				<div class="controls">
				<input class="password optional" title="重复密码" id="password-repeat"  size="50" name="rpassword" type="password" x-webkit-speech=""/>
				</div>
				</div>
		
				<div class="form-actions" >
				    <button class="btn btn-success" type="button" id="create">创建帐号</button>
				    点击“创建帐号”即表示您同意接受《
					<a target="_blank" href="/workxp/contract.html">CRM 服务协议</a>
					》 
				</div>
				</form>
			</div>
			<div class="span4">
				<div class="well">
					<h2>感谢您选择 CRM！</h2>
					<p></p>
					<h3>安全可靠</h3>
					<p>您的数据会加密存储，每日备份</p>
					<h3>优质的服务</h3>
					<p>您可以随时得到准确而友好的帮助</p>
				</div>
			</div>
		</div>
	</div>
	
	<script type="text/javascript" src="js/jquery-1.7.1.min.js"></script>
	<script type="text/javascript" src="js/bootstrap.min.js"></script>
	<script type="text/javascript" src="js/jquery.validity.js"></script>
	<script type="text/javascript" charset="UTF-8" src="js/jquery.validity.lang.zh.js"></script>
	
	<script type="text/javascript">
		$(function() {
			
			$("#create").click(function() {
				$("#sign-form").submit();
			});
			
			function checkEmail() {
				var result;
				$.ajaxSetup({
				  async: false
				});
				$.post("checkemail.jspx",{"user.email" : $("#email").val()}, function(msg){
					result = msg == 1 ? true : false;
				});
				
				return result;
			}
			
			$("#sign-form").validity(function() {
				$("#company").require().maxLength(100);
				$("#name").maxLength(20);
				$("#email").require().match("email").assert(checkEmail, "邮箱已被注册！");
				$("#password").require().minLength(6).maxLength(20);
				$("#password-repeat").require().assert($("#password").val().trim() == $("#password-repeat").val().trim(), "密码不一致！");
			});
		});
	</script>
</body>
</html>
